package com.motong.gongdan.config.auth;

import com.motong.gongdan.config.ResponseData;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Auther: FreddieFang
 * @Date: 2021/12/7 14:20
 * @Description:
 */
@ControllerAdvice
public class NewExceptionHandler {
    @ResponseBody
    @ExceptionHandler(LoginException.class)
    public ResponseData handleException(Exception e) {
        e.printStackTrace();
        return new ResponseData(((LoginException) e).getMsg(),Integer.valueOf(((LoginException) e).getCode()),null);
    }
}
